package com.ym.b2b.order.xc;

import com.ym.b2b.commons.exception.BaseException;
import java.sql.Connection;
import java.sql.DriverManager;

public class XCDBFactroy {
	
	/**
	 * @Description: 获取与宣传ERP的连接
	 * @Title: getXcCon 
	 * @Author cym
	 * @throws BaseException 一句话说明
	 * @Return Connection
	 * @Throws
	 */
	public static Connection getXcCon() throws BaseException {
		try {
			String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
			String dbURL = "jdbc:sqlserver://192.168.0.200:1433; DatabaseName=ksoa";
			String userName = "sa";
			String userPwd = "xcyyksoa";
			Class.forName(driverName);
			return DriverManager.getConnection(dbURL, userName, userPwd);
		} catch (Exception e) {
			e.printStackTrace();
		}
		throw new BaseException("ERP系统异常连接异常");
	}
	
	public static Connection getXcProviderCon() throws BaseException {
		try {
			String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
			String dbURL = "jdbc:sqlserver://192.168.0.196:1433; DatabaseName=ksoa_ch";
			String userName = "sa";
			String userPwd = "xcyyksoa";
			Class.forName(driverName);
			return DriverManager.getConnection(dbURL, userName, userPwd);
		} catch (Exception e) {
			e.printStackTrace();
		}
		throw new BaseException("ERP系统异常连接异常");
	}
}